#ifndef __ASQZPLAYER_OUTPUT_H__
#define __ASQZPLAYER_OUTPUT_H__

typedef size_t output_ctx;
typedef int (*buffer_available_proc)(output_ctx* ctx, size_t avail_size, void* user_data);
typedef int (*error_proc)(output_ctx* ctx, int error_code, void* user_data);

typedef struct output_param
{
   size_t size;
   size_t channels;
   size_t rate;
   size_t format;
} output_param;

typedef enum output_errors
{
   e_invalid_argument,
   e_internal_error,
   e_ok = 0,
} output_errors;

typedef enum output_status
{
   s_not_initialized,
   s_stopped,
   s_playing,
   s_error,
} output_status;

typedef struct output_callbacks
{
   buffer_available_proc buffer_available;
   void* buffer_available_user_data;

   error_proc error;
   void* error_user_data;

} output_callbacks;

int output_init(output_ctx** pctx, const char* device);
int output_shutdown(output_ctx* ctx);
int output_set_params(output_ctx* ctx, const output_param* param);
int output_set_callback(output_ctx* ctx, buffer_available_proc callback, void* user_data);
int output_set_callbacks(output_ctx* ctx, output_callbacks* callbacks);
int output_write_data(output_ctx* ctx, const void* data, size_t* size);
int output_start(output_ctx* ctx);
int output_stop(output_ctx* ctx);
int output_get_status(output_ctx* ctx, output_status* status);

#endif
